package com.hspedu.enum_;

public class Enumeration03 {
    public static void main(String[] args) {
        System.out.println(Season03.SPRING);
        System.out.println(Season03.SUMMER);
        System.out.println(Season03.AUTUMN);
        System.out.println(Season03.WINTER);
    }
}


//演示使用enum关键字实现枚举
enum Season03 {

    //使用enum来实现枚举类
    //1.使用关键字 enum 代替 class
    //2.public static final Season02 SPRING = new Season02("春天", "温暖");
    //  使用 SPRING("春天", "温暖");  替代
    //3.如果有多个对象，使用,间隔即可
    //4.如果使用 enum 关键字进行枚举，要求定义的常量对象写在最前面
    //5.如果使用无参构造器创建常量对象，括号可以省略
    SPRING("春天", "温暖"), SUMMER("夏天", "炎热"),
    AUTUMN("秋天", "凉爽"), WINTER("冬天", "寒冷"), WHAT;

    private String name;
    private String desc;

    private Season03() {
    }

    private Season03(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "Season02{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}